package com.dcbeida.db;

import android.content.ContentValues;
import android.database.Cursor;

import com.dcbeida.bean.Area;


public class AreaDatabaseBuilder extends DatabaseBuilder<Area> {
	@Override
	public Area build(Cursor query) {

		int columnUsername = query.getColumnIndex("name");
		int columnPcode = query.getColumnIndex("pcode");
		int columnCode = query.getColumnIndex("code");
//		
		Area area = new Area();
		area.setCode(query.getString(columnCode));
		area.setName(query.getString(columnUsername));
		area.setPcode(query.getString(columnPcode));
		return area;
	}

	@Override
	public ContentValues deconstruct(Area area) {
		ContentValues values = new ContentValues();
		values.put("name", area.getName());
		values.put("pcode", area.getPcode());
		values.put("code", area.getCode());

		
		return values;
	}
}
